#ifndef EASY_STRING_H
#define EASY_STRING_H

template <class VALUE_TYPE, int SIZE = 32>

class EasyString
{
private:
	VALUE_TYPE buf[SIZE];
public:
	EasyString()
	{
		buf[0] = 0;
	}

	operator const VALUE_TYPE* ()
	{
		return buf;
	}

	void operator = (EasyString* Estr)
	{
		strcpy(buf, Estr);
	}

	void operator = (const char* pstr)
	{
		strcpy(buf, pstr);
	}

	bool operator == (EasyString* Estr)
	{
		return compare(buf, Estr);
	}

	void Save(FILE* pFile)
	{
		int version = 0;
		fwrite(&version, sizeof(version), 1, pFile);

		int bufsize = SIZE;
		fwrite(&bufsize, sizeof(bufsize), 1, pFile);
		fwrite(buf, bufsize, 1, pFile);
	}

	void Load(FILE* pFile)
	{
		int version = 0;
		fread(&version, sizeof(version), 1, pFile);

		int bufsize = 0;
		fread(&bufsize, sizeof(bufsize), 1, pFile);
		fread(buf, bufsize, 1, pFile);
	}
};

typedef EasyString<char, 32> E_STRING;

#endif